using System;
using System.Collections.Generic;
using System.Text;
namespace CreamX.Framework.Game
{
    public class AnimationInfo : ICloneable
    {
        private AnimationInfo _animationAfter;

        public AnimationInfo AnimationAfter
        {
            get { return _animationAfter; }
            set { _animationAfter = value; }
        }


        private bool _leep;

        public bool Loop
        {
            get { return _leep; }
            set { _leep = value; }
        }

        private int _startFrame;

        public int StartFrame
        {
            get { return _startFrame; }
            set { _startFrame = value; }
        }

        private int _endFrame;

        public int EndFrame
        {
            get { return _endFrame; }
            set { _endFrame = value; }
        }

        private string _framelist;

        public string Frames
        {
            get { return _framelist; }
            set
            {

                _framelist = value;
                if (_framelist != string.Empty)
                {
                    string[] frr = _framelist.Split(',');
                    Array.Resize<int>(ref _frames, frr.Length);

                    for (int i = 0; i < frr.Length; i++)
                    {
                        _frames[i] = int.Parse(frr[i]);
                    }
                    _isInOrder = false;
                    _startFrame = 0;
                    _endFrame = _frames.Length - 1;
                }
                else
                    _isInOrder = true;
            }
        }
        internal bool _isInOrder = true;
        internal int _frameIndex = 0;

        private bool _reverse;

        public bool Reverse
        {
            get { return _reverse; }
            set { _reverse = value; }
        }

        private bool _isRunning;

        public bool IsRunning
        {
            get { return _isRunning; }
            set { _isRunning = value; }
        }

        private string _name;

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        private int _tileRows;

        public int TileRows
        {
            get { return _tileRows; }
            set { _tileRows = value; }
        }

        private int _tileCols;

        public int TileCols
        {
            get { return _tileCols; }
            set { _tileCols = value; }
        }

        private int _sizeX;

        public int SizeX
        {
            get { return _sizeX; }
            set { _sizeX = value; }
        }

        private int _sizeY;

        public int SizeY
        {
            get { return _sizeY; }
            set { _sizeY = value; }
        }

        private int _currentFrame;

        public int CurrentFrame
        {
            get { return _currentFrame; }
            set { _currentFrame = value; }
        }

        private int _frameCount;

        public int FrameCount
        {
            get { return _frameCount; }
            set { _frameCount = value; }
        }

        private int _animationSpeed;

        public int AnimationSpeed
        {
            get { return _animationSpeed; }
            set { _animationSpeed = value; }
        }

        int[] _frames;
        #region ICloneable Members

        public object Clone()
        {
            AnimationInfo __ai = new AnimationInfo();
            __ai.Loop = Loop;
            __ai.StartFrame = StartFrame;
            __ai.EndFrame = EndFrame;
            __ai.IsRunning = IsRunning;
            __ai.Name = Name;
            __ai.TileRows = TileRows;
            __ai.TileCols = TileCols;
            __ai.SizeX = SizeX;
            __ai.SizeY = SizeY;
            __ai.CurrentFrame = CurrentFrame;
            __ai.FrameCount = FrameCount;
            __ai.AnimationSpeed = AnimationSpeed;
            return __ai;
        }

        #endregion
    }
}
